<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .myimg{
            width:200px ;
            height: 200px;
            display: block;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <img src="./images/animal1.png" class="myimg"/>
</body>
<script>
    var myimg = document.getElementsByTagName("img")[0];
    //获取DOM元素的属性
    console.log(myimg.getAttribute("src"));
    console.log(myimg.getAttribute("class"));
    //点击图片时，修改图片的src属性值
    //setAttribute("属性名","属性值");
</script>
</html>